#include	"Vector3i.h"
#include	<cmath>

Vector3i::Vector3i()
{
}

Vector3i::~Vector3i()
{
}

Vector3i::Vector3i(int x, int y, int z)
{
	Set(x, y, z);
}

Vector3i::Vector3i(const Vector3i & vec)
{
	Set(vec);
}

Vector3i::Vector3i(const int * arr)
{
	Set(arr);
}

void Vector3i::Set(int x, int y, int z)
{
	m_data[0] = x;
	m_data[1] = y;
	m_data[2] = z;
}

void Vector3i::Set(const int * arr)
{
	m_data[0] = arr[0];
	m_data[1] = arr[1];
	m_data[2] = arr[2];
}

Vector3i::operator const int*() const
{
	return m_data;
}

Vector3i::operator int*()
{
	return m_data;
}

const Vector3i & Vector3i::operator+() const
{
	return *this;
}

Vector3i & Vector3i::operator+()
{
	return *this;
}

Vector3i Vector3i::operator-() const
{
	return Vector3i(-m_data[0], -m_data[1], -m_data[2]);
}

Vector3i & Vector3i::operator=(const Vector3i & vec)
{
	Set(vec);
	return *this;
}

Vector3i & Vector3i::operator+=(const Vector3i & vec)
{
	Set(m_data[0] + vec[0], m_data[1] + vec[1], m_data[2] + vec[2]);
	return *this;
}

Vector3i & Vector3i::operator-=(const Vector3i & vec)
{
	Set(m_data[0] - vec[0], m_data[1] - vec[1], m_data[2] - vec[2]);
	return *this;
}

Vector3i & Vector3i::operator*=(int num)
{
	Set(m_data[0] * num, m_data[1] * num, m_data[2] * num);
	return *this;
}

Vector3i & Vector3i::operator/=(int num)
{
	Set(m_data[0] / num, m_data[1] / num, m_data[2] / num);
	return *this;
}

Vector3i Vector3i::operator+(const Vector3i & vec) const
{
	return Vector3i(m_data[0] + vec[0], m_data[1] + vec[1], m_data[2] + vec[2]);
}

Vector3i Vector3i::operator-(const Vector3i & vec) const
{
	return Vector3i(m_data[0] - vec[0], m_data[1] - vec[1], m_data[2] - vec[2]);
}

Vector3i Vector3i::operator*(int num) const
{
	return Vector3i(m_data[0] * num, m_data[1] * num, m_data[2] * num);
}

Vector3i Vector3i::operator/(int num) const
{
	return Vector3i(m_data[0] / num, m_data[1] / num, m_data[2] / num);
}

Vector3i operator*(int num, const Vector3i & vec)
{
	return Vector3i(vec[0] * num, vec[1] * num, vec[2] * num);
}

bool Vector3i::operator==(const Vector3i & vec) const
{
	return (m_data[0] == vec[0]) && (m_data[1] == vec[1]) && (m_data[2] == vec[2]);
}

bool Vector3i::operator!=(const Vector3i & vec) const
{
	return (m_data[0] != vec[0]) || (m_data[1] != vec[1]) || (m_data[2] != vec[2]);
}

double Vector3i::LengthSquare() const
{
	return double(m_data[0] * m_data[0]) + double(m_data[1] * m_data[1]) + double(m_data[2] * m_data[2]);
}

double Vector3i::Length() const
{
	return std::sqrt(double(m_data[0] * m_data[0]) + double(m_data[1] * m_data[1]) + double(m_data[2] * m_data[2]));
}

